/**
 * There are <a href="https://github.com/thinkgem/jeesite">JeeSite</a> code generation
 */
package com.chlitina.store.modules.expert.entity;

import java.util.List;

import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
import javax.validation.constraints.NotNull;

import org.hibernate.annotations.Cache;
import org.hibernate.annotations.CacheConcurrencyStrategy;
import org.hibernate.annotations.NotFound;
import org.hibernate.annotations.NotFoundAction;

import com.chlitina.store.common.persistence.BaseEntity;
import com.google.common.collect.Lists;

/**
 * 专家推荐方案Entity
 * @author liujiang
 * @version 2013-07-22
 */
@Entity
@Table(name = "expert_experience_problem_solution")
@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
public class ExpertExperienceProblemSolution extends BaseEntity {
	
	private static final long serialVersionUID = 1L;
	private Long id; 		// 编号
	private SolutionFace solutionFace; 		// 方案
	private String skin_type; 	// 名称
	private int status;	// 状态：0 - 启用1 - 停用
	private int priority; 	// 排序优先级：	6 ： 敏感  	5 ： 痘痘  	4 ： 斑点  	3 ： 眼部  	2 ： 皱纹
	
	private List<ExpertExperienceProblemSolutionDetail> detailList = Lists.newArrayList();
	
	public ExpertExperienceProblemSolution() {
	}

	public ExpertExperienceProblemSolution(Long id){
		this();
		this.id = id;
	}
	
	@Id
	@GeneratedValue(strategy = GenerationType.IDENTITY)
	public Long getId() {
		return id;
	}

	public void setId(Long id) {
		this.id = id;
	}

	@ManyToOne(cascade={CascadeType.REFRESH}, fetch = FetchType.LAZY) 
	@JoinColumn(name="SOLUTION_ID")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	@NotNull
	public SolutionFace getSolutionFace() {
		return solutionFace;
	}

	public void setSolutionFace(SolutionFace solutionFace) {
		this.solutionFace = solutionFace;
	}

	public String getSkin_type() {
		return skin_type;
	}

	public void setSkin_type(String skin_type) {
		this.skin_type = skin_type;
	}

	public int getStatus() {
		return status;
	}

	public void setStatus(int status) {
		this.status = status;
	}
	
	@OneToMany(cascade={CascadeType.REFRESH, CascadeType.MERGE}, fetch=FetchType.LAZY,mappedBy="expertExperienceProblemSolution")
	@NotFound(action = NotFoundAction.IGNORE)
	@Cache(usage = CacheConcurrencyStrategy.READ_WRITE)
	public List<ExpertExperienceProblemSolutionDetail> getDetailList() {
		return detailList;
	}

	public void setDetailList(List<ExpertExperienceProblemSolutionDetail> detailList) {
		this.detailList = detailList;
	}
	

	public int getPriority() {
		return priority;
	}

	public void setPriority(int priority) {
		this.priority = priority;
	}
}